#include<string>
#include<unistd.h>

class Channel
{
public:
    Channel(int wfd, int who)
        : _wfd(wfd), _who(who)
    {
        _name = "Channel-" + std::to_string(wfd) + "pid-" + std::to_string(who);
    }
    std::string name()
    {
        return _name;
    }
    void send(int num)
    {
        ::write(_wfd, &num, sizeof(num));
    }
    
    int fd()
    {
        return _wfd;
    }

    int id()
    {
        return _who;
    }

    ~Channel()
    {
    }

private:
    int _wfd;
    std::string _name;
    int _who; // 子进程pid
};